<?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');

class Reports extends MY_Controller {

	public function __construct() {
		parent::__construct();
		$this -> load -> model('Reports_model');
		$this -> load -> helper('form');
		$this -> load -> library('pagination');
	}

	public function index() {
		$config = array();
		$config["base_url"] = base_url() . "reports/index";
		$config["total_rows"] = $this -> Reports_model -> record_count();
		$config["per_page"] = 10;
		$config["uri_segment"] = 3;
		$this -> pagination -> initialize($config);
        	$page = ($this -> uri -> segment(3)) ? $this -> uri -> segment(3) : 0;
		$data["results"] = $this -> Reports_model -> fetch_urls($config["per_page"], $page);
		$data["links"] = $this -> pagination -> create_links();
		
		//   $data['results'] = $this->Search_model->getUrl();
		$this -> data['total_rows'] = $config["total_rows"];
		$data['optionbrowser'] = $this->Reports_model->getbrowser();
		$data['optionos'] = $this->Reports_model->getos();
		//print_r($this->Reports_model->getbrowser()); die;
		$this -> show_view('reports', $data);
	}

	function search_keyword() {
		//Search Engine
		
		$config = array();
		$config["base_url"] = base_url() . "reports/search_keyword";
		$config["total_rows"] = count($this -> Reports_model -> searchUrls1());
		$config["per_page"] = 10;
		$config["uri_segment"] = 3;
		$this -> pagination -> initialize($config);
		$page = ($this -> uri -> segment(3)) ? $this -> uri -> segment(3) : 0;
		$data["results"] = $this -> Reports_model -> searchUrls($config["per_page"], $page);
		$data["links"] = $this -> pagination -> create_links();
		$data['optionbrowser'] = $this->Reports_model->getbrowser();
		$data['optionos'] = $this->Reports_model->getos();
		//print_r($this->data['optionbrowser']); die;
		//   $data['results'] = $this->Search_model->getUrl();
		$this -> data['total_rows'] = $config["total_rows"];
		$this -> show_view('reports', $data);
	}

	function DeleteUrl() {
		$res=$this -> Reports_model -> DeleteUrl('$id');
		if($res=='1'){
                    $this->session->set_flashdata('msg', 'Successfully Deleted');
                    redirect(base_url().'reports');
                }else{
                    $this->session->set_flashdata('msg', 'Somthing is wrong NOT Deleted');
                    redirect(base_url().'reports');
                }
	}
        
        function ipdetail(){
            $data['result'] = $this -> Reports_model ->ipdetail();
            //print_r($data);
            $this->load->view('ipdetail', $data);
    }
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
